package com.sharemarking.wa.common.exception;

import com.sharemarking.wa.common.ResponseParams;
import com.sharemarking.wa.common.SysHttpStatus;
import org.springframework.http.HttpStatus;
/**
 * Created by king on 2018/06/11.
 * 请求异常 (参数不完整，参数异常，数据异常等) 400
 */
public class RequestException extends Exception {

    private static final long serialVersionUID = 1L;

    public static final HttpStatus HTTPSTATUS = HttpStatus.BAD_REQUEST;
    
    private ResponseParams<?> responseParams;
    
    private RequestException() {

    }

    public ResponseParams<?> getResponseParams() {
        return responseParams;
    }
    
    public static RequestException create(ResponseParams<?> responseParams) {
    		RequestException re=new RequestException();
    		if(responseParams==null) {
    			responseParams=ResponseParams.error(SysHttpStatus.ERROR);
    		}
    		re.responseParams=responseParams;
    		return re;
    }

}
